import Vue from 'vue'
import Vuex from 'vuex'
import getters from '@/store/getters'
import app from '@/store/modules/app'
import settings from '@/store/modules/settings'
import user from '@/store/modules/user'
import createPersistedState from "vuex-persistedstate"
import tagsView from "@/store/modules/tagsView";

Vue.use(Vuex)

const store = new Vuex.Store({
    modules: {
        app,
        settings,
        tagsView,
        user
    },
    plugins: [createPersistedState({
        storage: window.sessionStorage,
        reducer(val) {
            return {
                // 只储存state中的user
                user: val.user
            }
        }
    })],
    getters
})

export default store
